package com.sl.biz.modular.cdc.dao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sl.biz.modular.cdc.dao.domain.entity.CdcTableConfigDO;
import com.sl.biz.modular.cdc.dao.mapper.CdcTableConfigMapper;
import com.sl.biz.modular.cdc.dao.service.CdcTableConfigDaoService;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CdcTableConfigDaoServiceImpl extends ServiceImpl<CdcTableConfigMapper, CdcTableConfigDO> implements CdcTableConfigDaoService {
    @Override
    public List<CdcTableConfigDO> queryByCdcIds(List<String> cdcConfigId) {
        LambdaQueryWrapper<CdcTableConfigDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.in(CdcTableConfigDO::getCdcId, cdcConfigId);
        return super.list(lambdaQueryWrapper);
    }

    @Override
    public Boolean removeByCdcId(String cdcId) {
        LambdaQueryWrapper<CdcTableConfigDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(CdcTableConfigDO::getCdcId,cdcId);
        return super.remove(lambdaQueryWrapper);
    }

    @Override
    public List<CdcTableConfigDO> queryByDatabaseIds(List<String> databaseIds) {
        LambdaQueryWrapper<CdcTableConfigDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.in(CdcTableConfigDO::getCdcDatabaseId, databaseIds);
        return super.list(lambdaQueryWrapper);
    }
}
